<?php 

if (!defined('BB_ROOT')) die(basename(__FILE__)); 
require(INC_DIR .'functions_torrent.php'); 
set_time_limit(30000); 

$sql = DB()->fetch_rowset("SELECT tor.*, at.physical_filename FROM ". BB_BT_TORRENTS ." tor, ". BB_ATTACHMENTS_DESC ." at WHERE tor.attach_id = at.attach_id ORDER BY tor.attach_id"); 
foreach($sql as $data) 
{ 
     $attach_id = $data['attach_id']; 

    if($data['tor_announcers'] && ($data['tor_time'] < TIMENOW)) 
    { 
         $seeders  = array(); 
          $leechers = array(); 
          $peers    = array(); 
          multitracker($data, $seeders, $leechers, $peers); 
        $tor_time = TIMENOW + 900;  
          if($tor_seeders > 0) $last_seeder = ', seeder_last_seen = '. TIMENOW; 
          else $last_seeder = ''; 
          DB()->query("UPDATE ". BB_BT_TORRENTS ." SET tor_seeders = '$seeders', tor_leechers = '$leechers', tor_time = '$tor_time' $last_seeder WHERE attach_id = '$attach_id' LIMIT 1"); 
     } 
}